package com.jiuyin.dianjing.ui.activity.setting;


import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.jiuyin.dianjing.BuildConfig;
import com.jiuyin.dianjing.R;
import com.jiuyin.dianjing.ui.activity.base.BaseActivity;
import com.jiuyin.dianjing.ui.activity.webview.WebViewContainer;

import butterknife.BindView;
import butterknife.OnClick;

import static com.jiuyin.dianjing.api.constant.ApiConstant.KEY_TITLE;
import static com.jiuyin.dianjing.api.constant.ApiConstant.KEY_URL;
import static com.jiuyin.dianjing.constant.AppConstant.URL_FW;
import static com.jiuyin.dianjing.constant.AppConstant.URL_YS;

public class AboutJiuYinActivity extends BaseActivity {
    @BindView(R.id.tv_version)
    TextView mVersion;

    @Override
    protected int setLayoutId() {
        return R.layout.activity_about_jiu_yin;
    }

    @Override
    protected void initData() {

    }

    @SuppressLint("SetTextI18n")
    @Override
    protected void initView() {
        setTitle(R.string.setting_about_company);
        mVersion.setText("版本："+BuildConfig.VERSION_NAME);
    }

    @OnClick({R.id.tv_user_agreement, R.id.tv_privacy_policy})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_user_agreement:
                String url = URL_FW;
                gotoWeb(url, getString(R.string.setting_user_agreement));
                break;
            case R.id.tv_privacy_policy:
                String urlPri = URL_YS;
                gotoWeb(urlPri, getString(R.string.setting_privacy_policy));
                break;
        }
    }

    private void gotoWeb(String url, String title) {
        Bundle bundle = new Bundle();
        bundle.putString(KEY_URL, url);
        bundle.putString(KEY_TITLE, title);
        goTargetActivity(WebViewContainer.class, bundle);
    }
}